package com.yzd.learnjava.enumerated;

public enum RoShamBo4 implements Competitor<RoShamBo4>{
	ROCK{
		public Outcome compete(RoShamBo4 competetor) {
			return compete(RoShamBo4.SCISSORS, competetor);
		}
	}, 
	SCISSORS{
		public Outcome compete(RoShamBo4 competetor) {
			return compete(RoShamBo4.PAPER, competetor);
		}
	}, 
	PAPER{
		public Outcome compete(RoShamBo4 competetor) {
			return compete(RoShamBo4.ROCK, competetor);
		}
	};
	
	public Outcome compete(RoShamBo4 loser, RoShamBo4 opponent) {
		return ((opponent == this) ? Outcome.DRAW : ((opponent == loser) ? Outcome.LOSE : Outcome.WIN));
	}
	
	public static void main(String[] args) {
		RoShamBo.play(RoShamBo4.class, 20);
	}
}
